from flask import Flask
from app.extensions import db, migrate, cors
from config import Config
from app.models import *



def create_app():
    app = Flask(__name__)
    app.config.from_object(Config)

    db.init_app(app)
    migrate.init_app(app, db)

    # 注册蓝图
    from app.views.login import login_bp
    from app.views.admin import admin_bp
    app.register_blueprint(login_bp)
    app.register_blueprint(admin_bp)

    cors.init_app(app)

    return app